#include <algorithm>
#include <vector>
#include<iostream>
#include<limits>

struct skill
{
    int d;
    int h;
};

class cal
{
public:
    int h=0;
    int minr = std::numeric_limits<int>::max();

    void f(std::vector<skill>& skills, int index, int len)
    {
        if (index == len)
        {
            int now = cale(skills, len);
            minr = std::min(now, minr);
         
     /*for (int j = 0; j < len; j++)
     {
         std::cout <<  ' ' << skills[j].d ;
     }
            std::cout << std::endl;*/
            return;
        }
        for (int i = index; i < len; i++)
        {
            swap(skills,index,i);
            f(skills,index+1,len);
            swap(skills,index,i);
        }
    }

    int cale(const std::vector<skill>& skills, int len)
    {
        int hp = h;
        int i = 0;
        for (; i < len; i++)
        {
            if (hp <= skills[i].h)
            {
                hp -= skills[i].d * 2;
            }
            else
            {
                hp -= skills[i].d;
            }
            if (hp <= 0) return (i + 1);
        }
        return std::numeric_limits<int>::max();
    }
    void swap(std::vector<skill>& skills,int left ,int right)
    {
        int l= skills[left].d;
        int r = skills[left].h;
        skills[left].d= skills[right].d;
        skills[left].h= skills[right].h;
        skills[right].d= l;
        skills[right].h= r;
    }
};

/*int main()
{
    std::vector<skill> a;
    a.resize(10);
    int n;
    std::cin >> n;
    cal * ss = new cal;
    for (int i = 0; i < n; i++)
    {
        int s;
        int h;

        ss->minr = std::numeric_limits<int>::max();
        std::cin >> s >> h;
        ss->h = h;
        for (int j = 0; j < s; j++)
        {
            std::cin >> a[j].d >> a[j].h;
        }

ss->f(a,0,s);
        if (ss->minr >10)
        {
            std::cout << "-1" << std::endl;
        }else
        {
            std::cout << ss->minr << std::endl;
        }
        /*std::cout << '#' << i << s << h << std::endl;
        for (int j = 0; j < s; j++)
        {
            std::cout << '#' << a[j].d << a[j].h << std::endl;
        }#1#
    }
}*/
